<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
// 传统方式
function say (name, mess) {
    console.log(name, mess)  // XiaoSong hello
}
say('XiaoSong', 'hello')

// 使用arguments
function say1() {
    console.log(arguments[0], arguments[1])
}
say1('XiaoSong1', 'hello')

// 函数重载
function toAdd () { 
    if (arguments.length === 0) { 
        console.log(arguments[0] + 10)
    } else if (arguments.length === 2) {
        console.log(arguments[0] + arguments[1])
    }
}

function toAdd1 (num1, num2) {
    console.log(num2)  // 10
    arguments[1] = 20
    console.log(num2) // 20
}
toAdd1(10, 10)
</script>
</body>
</html>